package cn.com.pc.content.domain.article;

import cn.com.pc.content.domain.audit.AuditStatus;
import cn.com.pc.content.domain.Biz;
import cn.com.pc.content.domain.Site;
import cn.com.pc.content.domain.view.ArticleView;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ArticleRepository extends MongoRepository<Article, String> {
    Article findByIdAndAuditStatusNot(String id, AuditStatus auditStatus);

    boolean existsByReferIdAndSiteAndBizAndAuditStatusNot(String referId, Site site, Biz biz, AuditStatus auditStatus);

    Page<ArticleView> findAllByReferIdInAndSiteAndBizAndAuditStatusNot(List<String> referIds,Site site, Biz biz, AuditStatus auditStatus, Pageable pageable);

    Page<ArticleView> findAllByIdInAndAuditStatusNot(List<String> ids,AuditStatus auditStatus, Pageable pageable);
}
